﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Settings;

namespace SMSROUTER.Business
{
    public partial class ClientRefuse
    {
        #region Singleton Pattern
        private static object _lock = new object();
        private static List<string> _instance;
        public static List<string> GetInstance()
        {
            lock (_lock)
            {
                if (_instance == null)
                {
                    lock (_lock)
                    {
                        using (var context = new DBDataContext(AppSetting.ConnectionString))
                        {
                            _instance = context.ClientRefuses.Select(p => p.PhoneNumber).ToList();
                        }
                    }
                }
            }
            return _instance;
        }
        public static void ReloadData()
        {
            lock (_lock)
            {
                using (var context = new DBDataContext(AppSetting.ConnectionString))
                {
                    _instance = context.ClientRefuses.Select(p => p.PhoneNumber).ToList();
                }
            }
        }
        #endregion Singleton Pattern

        #region Static method
        #endregion Static method
    }
}
